import fetch from 'utils/fetch';

// e启学霸

//查询所属分类
export function listAdvertByCondition() {
    return fetch({
        url: '/scholar/listScholarType',
        method: 'post'
    });
}

//分页查询e启学霸
export function pageScholar(sVideoName, sPayType, fTypeId, time, sStatus, page, rows) {
    let data = {
        sVideoName,
        sPayType,
        fTypeId,
        time,
        sStatus
    }
    return fetch({
        url: `/scholar/pageScholar/${page}/${rows}`,
        method: 'post',
        data
    });
}

//保存e启学霸
export function saveScholar(sVideoName, sCoverUrl, sVideoUrl, sDesc, sPayType, sOriginalPrice, sNowPrice, fTypeId, sPriority) {
    let data = {
        sVideoName,
        sCoverUrl,
        sVideoUrl,
        sDesc,
        sPayType,
        sOriginalPrice,
        sNowPrice,
        fTypeId,
        sPriority
    }
    return fetch({
        url: '/scholar/saveScholar',
        method: 'post',
        data
    });
}

//查看详情
export function getScholarInfo(pId) {
    let data = {
        pId
    }
    return fetch({
        url: '/scholar/getScholarInfo',
        method: 'post',
        data
    });
}

//分页查询e启学霸评论
export function pageScholarComment(fScholarId, page, rows) {
    let data = {
        fScholarId,
        page,
        rows
    }
    return fetch({
        url: `/scholar/pageScholarComment/${page}/${rows}`,
        method: 'post',
        data
    });
}

//e启学霸评论删除
export function deleteScholarComment(pId) {
    let data = {
        pId
    }
    return fetch({
        url: '/scholar/deleteScholarComment',
        method: 'post',
        data
    });
}

//编辑
export function updateScholar(pId, sVideoName, sCoverUrl, sVideoUrl, sDesc, sPayType, sOriginalPrice, sNowPrice, fTypeId, sPriority) {
    let data = {
        pId,
        sVideoName,
        sCoverUrl,
        sVideoUrl,
        sDesc,
        sPayType,
        sOriginalPrice,
        sNowPrice,
        fTypeId,
        sPriority
    }
    return fetch({
        url: '/scholar/updateScholar',
        method: 'post',
        data
    });
}

//e启学霸上架/下架
export function updateScholarStatus(pId) {
    let data = {
        pId
    }
    return fetch({
        url: '/scholar/updateScholarStatus',
        method: 'post',
        data
    });
}

//e启学霸批量删除
export function deleteBatchScholar(pIds) {
    let data = {
        pIds
    }
    return fetch({
        url: '/scholar/deleteBatchScholar',
        method: 'post',
        data
    });
}